﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Specialized;
using System.Runtime.Serialization;

namespace ERPStore.Models
{
	/// <summary>
	/// Liste des produits trouvés lors d'une recherche
	/// </summary>
	[Serializable]
	[CollectionDataContract]
	public class ProductList : List<Product>, IPaginable
	{
		public ProductList()
			: base(new List<Product>())
		{

		}

		public ProductList(IEnumerable<Product> list)
			: base(list)
		{

		}

		/// <summary>
		/// Terme de recherche
		/// </summary>
		/// <value>The search.</value>
		[DataMember]
		public string Query { get; set; }

		/// <summary>
		/// Liste des propriétés etendues passée en parametre de l'url
		/// </summary>
		/// <value>The extended parameters.</value>
		[IgnoreDataMember]
		public NameValueCollection ExtendedParameters { get; set; }

		/// <summary>
		/// categorie passée en paramètre de l'url
		/// </summary>
		/// <value>The category code.</value>
		[IgnoreDataMember]		
		public Models.ProductCategory Category { get; set; }

		/// <summary>
		/// Marque passée en paramètre de l'url
		/// </summary>
		/// <value>The brand.</value>
		[IgnoreDataMember]
		public Models.Brand Brand { get; set; }

		/// <summary>
		/// Id de la selection en cours
		/// </summary>
		/// <value>The name of the selection.</value>
		[DataMember]
		public int? SelectionId { get; set; }

		/// <summary>
		/// Type de liste
		/// </summary>
		/// <value>The type of the list.</value>
		[DataMember]
		public ProductListType ListType { get; set; }

		/// <summary>
		/// Type de relation entre les produits
		/// </summary>
		/// <value>The type of the relation.</value>
		[DataMember]
		public ProductRelationType RelationType { get; set; }

		/// <summary>
		/// Terme de substitution
		/// </summary>
		/// <value>The substitution.</value>
		[DataMember]
		public ProductSearchSubstitution Substitution { get; set; }

		#region IPaginable Members

		[DataMember]
		public int ItemCount { get; set; }

		[DataMember]
		public int PageIndex { get; set; }

		[DataMember]
		public int PageSize { get; set; }

		#endregion
	}
}
